{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 匯入DEA.py\n",
    "import DEA"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The efficiency of DMU A:0.902\n",
      "The efficiency of DMU B:0.833\n",
      "The efficiency of DMU C:0.904\n",
      "The efficiency of DMU D:0.415\n",
      "The efficiency of DMU E:0.809\n",
      "The efficiency of DMU F:0.964\n",
      "The efficiency of DMU G:1.000\n",
      "The efficiency of DMU I:1.000\n",
      "The efficiency of DMU J:1.000\n",
      "The efficiency of DMU K:0.530\n",
      "The efficiency of DMU L:1.000\n",
      "The efficiency of DMU M:1.000\n",
      "The efficiency of DMU O:0.756\n"
     ]
    }
   ],
   "source": [
    "# 投入與產出資料位於名為data的csv檔內，且指定第2、4行為投入資料，第5、8行為產出資料\n",
    "DMU,X,Y = DEA.csv2dict(\"data.csv\",in_range=[2,4],out_range=[5,8],assign=True)\n",
    "\n",
    "# Input-orient CRS model\n",
    "DEA.CRS_input(DMU,X,Y)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The efficiency of DMU A:0.902\n",
      "The efficiency of DMU B:0.833\n",
      "The efficiency of DMU C:0.904\n",
      "The efficiency of DMU D:0.415\n",
      "The efficiency of DMU E:0.809\n",
      "The efficiency of DMU F:0.964\n",
      "The efficiency of DMU G:1.000\n",
      "The efficiency of DMU I:1.000\n",
      "The efficiency of DMU J:1.000\n",
      "The efficiency of DMU K:0.530\n",
      "The efficiency of DMU L:1.000\n",
      "The efficiency of DMU M:1.000\n",
      "The efficiency of DMU O:0.756\n"
     ]
    }
   ],
   "source": [
    "# 投入與產出資料分別位於名為data_input與data_output的csv檔內，且無指定特定幾行為投入或產出資料\n",
    "DMU, X = DEA.csv2dict_sep(\"data_input.csv\")\n",
    "DMU, Y = DEA.csv2dict_sep(\"data_output.csv\")\n",
    "\n",
    "# 並使用對偶形式的投入導向CRS Model\n",
    "DEA.DualIOCRS(DMU,X,Y)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The efficiency of DMU A:1.000\n",
      "The efficiency of DMU B:1.000\n",
      "The efficiency of DMU C:1.000\n",
      "The efficiency of DMU D:0.735\n",
      "The efficiency of DMU E:0.848\n",
      "The efficiency of DMU F:1.000\n",
      "The efficiency of DMU G:1.000\n",
      "The efficiency of DMU I:1.000\n",
      "The efficiency of DMU J:1.000\n",
      "The efficiency of DMU K:0.876\n",
      "The efficiency of DMU L:1.000\n",
      "The efficiency of DMU M:1.000\n",
      "The efficiency of DMU O:0.776\n"
     ]
    }
   ],
   "source": [
    "# 投入與產出資料位於名為data的csv檔內，且指定第2、4行為投入資料，第5、8行為產出資料\n",
    "DMU,X,Y = DEA.csv2dict(\"data.csv\",in_range=[2,4],out_range=[5,8],assign=True)\n",
    "\n",
    "#並使用投入導向的VRS Model(不顯示𝑢_𝑜𝑟值)\n",
    "DEA.VRS_input(DMU,X,Y, False)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The efficiency of DMU A:1.000\n",
      "u0_A = -0.721\n",
      "The efficiency of DMU B:1.000\n",
      "u0_B = -0.430\n",
      "The efficiency of DMU C:1.000\n",
      "u0_C = 0.596\n",
      "The efficiency of DMU D:0.735\n",
      "u0_D = -0.735\n",
      "The efficiency of DMU E:0.848\n",
      "u0_E = 0.041\n",
      "The efficiency of DMU F:1.000\n",
      "u0_F = 0.192\n",
      "The efficiency of DMU G:1.000\n",
      "u0_G = -1.000\n",
      "The efficiency of DMU I:1.000\n",
      "u0_I = -0.043\n",
      "The efficiency of DMU J:1.000\n",
      "u0_J = -0.148\n",
      "The efficiency of DMU K:0.876\n",
      "u0_K = -0.610\n",
      "The efficiency of DMU L:1.000\n",
      "u0_L = 0.066\n",
      "The efficiency of DMU M:1.000\n",
      "u0_M = 0.035\n",
      "The efficiency of DMU O:0.776\n",
      "u0_O = 0.050\n"
     ]
    }
   ],
   "source": [
    "# 投入與產出資料位於名為data的csv檔內，且指定第2、4行為投入資料，第5、8行為產出資料\n",
    "DMU,X,Y = DEA.csv2dict(\"data.csv\",in_range=[2,4],out_range=[5,8],assign=True)\n",
    "\n",
    "#並使用投入導向的VRS Model(顯示𝑢_𝑜𝑟值)\n",
    "DEA.VRS_input(DMU,X,Y, True)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
